<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/logic/CustomCommand.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/entity/JobHistory.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Command to create a job history
	*/
	class CommandCreateJobHistory extends CustomCommand {
		/*
		 * Constructor of the class
		 */
		public function __construct($startDate, $endDate, $job, $salary, $ci, $departmentId) {
			$this -> jobHistory = new JobHistory($startDate, $endDate, $job, $salary, $ci, 
				$departmentId);
		}
		
		/*
		 * Method to execute to create a job history
		 */
		public function execute() {			
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$ijhad = $daoFactory -> getMySqlJobHistoryAccessDao();			
			$jobHistoryCreation = $ijhad -> createJobHistory($this -> jobHistory);
	
			$this -> result = $jobHistoryCreation;
		}
	}
?>